/**
 * Created by Administrator on 2017/4/7 0007.
 */
Main3D={
    Create:function(){
        var main={};
        var scene,camera, renderer;
        scene=new THREE.Scene();
        camera=new THREE.PerspectiveCamera(70,window.innerWidth / window.innerHeight,1,10000);
        renderer=new THREE.WebGLRenderer({antialias:true});
        // renderer=new THREE.CSS3DRenderer({antialias:true});
        renderer.domElement.style.position='absolute';
        // document.getElementById('Layer3D').appendChild(renderer.domElement);
        var container=document.createElement("div");
        container.id="Layer3D";
        document.body.appendChild(container);
        container.style.position="absolute";
        container.appendChild(renderer.domElement);


        // renderer.setPixelRatio(window.devicePixelRatio ? window.devicePixelRatio : 1);
        renderer.setSize( window.innerWidth, window.innerHeight );

        window.addEventListener('resize', onWindowResize, false);

        function onWindowResize(){
            camera.aspect = window.innerWidth / window.innerHeight;
            camera.updateProjectionMatrix();

            renderer.setSize(window.innerWidth, window.innerHeight);
        }


        var space=Space.Create(scene,camera,renderer);

        animate();
        function animate(){
            requestAnimationFrame(animate);
            renderer.render(scene,camera);
            // controls.update();
            camera.updateProjectionMatrix();


            if(space){
                space.DoIt();
            }
        }

        return main;
    }
}
